/**
 * 
 */
package org.statewalker.core;

/**
 * @author kotelnikov
 */
public class DelegateStateExecutor implements IStateExecutor {

    private IStateExecutor fExecutor;

    /**
     * 
     */
    public DelegateStateExecutor(IStateExecutor executor) {
        fExecutor = executor;
    }

    /**
     * @see org.statewalker.core.IStateExecutor#activateState(org.statewalker.core.Process,
     *      org.statewalker.core.IState, org.statewalker.core.IEvent)
     */
    public void activateState(Process process, IState state, IEvent event) {
        beginActivation(process, state, event);
        fExecutor.activateState(process, state, event);
        endActivation(process, state, event);
    }

    protected void beginActivation(Process process, IState state, IEvent event) {
    }

    protected void beginDeactivation(Process process, IState state, IEvent event) {
    }

    /**
     * @see org.statewalker.core.IStateExecutor#deactivateState(org.statewalker.core.Process,
     *      org.statewalker.core.IState, org.statewalker.core.IEvent)
     */
    public void deactivateState(Process process, IState state, IEvent event) {
        beginDeactivation(process, state, event);
        fExecutor.deactivateState(process, state, event);
        endDeactivation(process, state, event);
    }

    protected void endActivation(Process process, IState state, IEvent event) {
    }

    protected void endDeactivation(Process process, IState state, IEvent event) {
    }

}
